home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 11 / CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso / cucd / programming / oberonv4 / source / system / infoelems.mod (.txt) < prev    next >
Oberon Text  |  1996-04-22  |  3KB  |  91 lines

  1. Syntax10.Scn.Fnt
  2. InfoElems
  3. Alloc
  4. Syntax10.Scn.Fnt
  5. StampElems
  6. Alloc
  7. 11 Dec 95
  8. "Title": InfoElems - a new kind of text elements.
  9. "Author": Christoph Steindl (CS)
  10. "Abstract": AuthorElems are a new kind of text elements. They are like PopupElems
  11.     and contain additional information about a text (like title, author, abstract, version,
  12.     date of creation and date of most recent modification).
  13. "Keywords": information about a document, information retrieval
  14. "Version": 1.0
  15. "From": 25 Oct 94
  16. "Until": 
  17. "Changes": 
  18. "Hints": This text can again contain arbitrary text elements!
  19. Syntax10b.Scn.Fnt
  20. MarkElems
  21. Alloc
  22. MODULE InfoElems; 
  23. IMPORT Display, Viewers, Texts, TextFrames, PopupElems, Oberon;
  24.     icon: Display.Pattern;
  25.     Elem* = POINTER TO ElemDesc;
  26.     ElemDesc* = RECORD (PopupElems.ElemDesc) END ;
  27. PROCEDURE 
  28. Handle* (e: Texts.Elem; VAR m: Texts.ElemMsg);
  29.     VAR e1: Elem;
  30. BEGIN
  31.     WITH e: Elem DO
  32.         WITH m: Texts.CopyMsg DO
  33.             IF m.e = NIL THEN NEW(e1); m.e := e1 END ;
  34.             PopupElems.Handle(e, m)
  35.         | m: Texts.IdentifyMsg DO
  36.             m.mod := "InfoElems"; m.proc := "Alloc"
  37.         | m: TextFrames.DisplayMsg DO
  38.             IF m.prepare THEN
  39.                 e.W := 13 * TextFrames.Unit; e.H := LONG(TextFrames.menuH-1) * TextFrames.Unit;
  40.             ELSE e.name := ""; PopupElems.Handle(e, m);
  41.                 Display.CopyPattern(Display.white, icon, m.X0+2, m.Y0+2, Display.paint)
  42.             END
  43.         ELSE PopupElems.Handle(e, m)
  44.         END
  45. END Handle;
  46. PROCEDURE 
  47. Alloc*;
  48.     VAR e: Elem;
  49. BEGIN
  50.     NEW(e); e.handle := Handle; Texts.new := e;
  51. END Alloc;
  52. PROCEDURE 
  53. Insert*;
  54.     VAR e: Elem; insert: TextFrames.InsertElemMsg; Wr: Texts.Writer; t, d: LONGINT;
  55. BEGIN
  56.     NEW(e); e.handle := Handle; e.name := ""; e.small := TRUE;
  57.     e.menu := TextFrames.Text("");
  58.     Texts.OpenWriter(Wr);
  59.     Texts.WriteString(Wr, '"Title": no title'); Texts.WriteLn(Wr);
  60.     Texts.WriteString(Wr, '"Author": no name'); Texts.WriteLn(Wr);
  61.     Texts.WriteString(Wr, '"Abstract": no abstract'); Texts.WriteLn(Wr);
  62.     Texts.WriteString(Wr, '"Keywords": no keywords'); Texts.WriteLn(Wr);
  63.     Texts.WriteString(Wr, '"Version": no version'); Texts.WriteLn(Wr);
  64.     Texts.WriteString(Wr, '"From": '); Oberon.GetClock(t, d); Texts.WriteDate(Wr, t, d); Texts.WriteLn(Wr);
  65.     Texts.WriteString(Wr, '"Until": no date (use StampElems.Insert)'); Texts.WriteLn(Wr);
  66.     Texts.WriteString(Wr, '"Changes": no changes'); Texts.WriteLn(Wr);
  67.     Texts.WriteString(Wr, '"Hints": This text can again contain arbitrary text elements!'); Texts.WriteLn(Wr);
  68.     Texts.Append(e.menu, Wr.buf);
  69.     PopupElems.MeasureMenu(e);
  70.     insert.e := e; Viewers.Broadcast(insert)
  71. END Insert;
  72. PROCEDURE 
  73. InitIcon;
  74.     VAR line: ARRAY 11 OF SET;
  75. BEGIN
  76.     line[10] := {2..7};
  77.     line[9] := {1, 8};
  78.     line[8] := {0, 3..6, 9};
  79.     line[7] := {0, 2, 7, 9};
  80.     line[6] := {0, 2, 9};
  81.     line[5] := {0, 2, 9};
  82.     line[4] := {0, 2, 7, 9};
  83.     line[3] := {0, 3..6, 9};
  84.     line[2] := {1, 8};
  85.     line[1] := {2..7};
  86.     icon := Display.NewPattern(line, 12, 10);
  87. END InitIcon;
  88. BEGIN
  89.     InitIcon;
  90. END InfoElems.
  91.